/*
 * Copyright (c) 2009 Seth Wessitsh (seth@wessitsh.com)
 * Licensed under the MIT (MIT-LICENSE.txt) licence.
 */

/**
	The JSON.schema.err.messages namespace is a hash of language codes to collections of error
	messages used in order to retrive a localized message for the error classes in JSON.schema.err.

	The error messages are used by the JSON.schema.err.*Localizer classes and will be parsed for
	references to the properties of the error object.  The references are of the form {<path>} where
	<path> is a JSON.path using the error object as the root.  So, for example, in order to retrieve
	the current path from the data property of the current error one could use {data.current.path}. 
	The error code could be retrieved using {code}.	
 */
var JSON = JSON ? JSON : {};
JSON.schema = JSON.schema ? JSON.schema : {};
JSON.schema.err = JSON.schema.err ? JSON.schema.err : {};

/**
	@schema {
		id: "JSON.schema.err.messages",
		type: "object",

		description: "
			A hash of language codes to collections of error messages.  I.e., the property
			names are language codes, and the property values are hashes of error codes to
			localized error messages",

		additionalProperties: {
			"type": "object",

			additionalProperties: { type: "string",
				description: "
					A hash of error codes to localized error messages. The error message may contain
					references to the properties of the error class it is intended for.  The 
					references are of the form {<path>} where <path> is a JSON.path using the error 
					object as the root.  So, for example, in order to retrieve the current path from
					the data property of the current error one could use {data.current.path}. The 
					error code could be retrieved using {code}." } } }
 */
JSON.schema.err.messages = JSON.schema.err.messages ? JSON.schema.err.messages : {};

JSON.schema.err.messages.en = {
	"RTE000": "`{data.current.path}' cannot appear because the type `{data.requires.value}' has been either implicitly or explicity disallowed.",
	"RTE001": "`{data.current.path}' cannot appear unless the restriction `{data.requires.path}' is a `{data.requires.value}'",
	"STE000": "`{data.current.path}' must be a subtype of `{data.conflictsWith.path}'",
	"STE001": "Overriding property `{data.current.path}' must be a subtype of `{data.conflictsWith.path}'",
	"STE002": "Property `{data.current.path}' is not a subtype of `{data.conflictsWith.path}'",
	"STE003": "`{data.current.path}' must be a subtype of all types in `{data.conflictsWith.path}'",
	"STE004": "`{data.current.path}' must be a subtype of the ancestor restriction `{data.conflictsWith.path}'",
	"STE005": "All types in `{data.current.path}' must be subtypes of `{data.conflictsWith.path}'",
	"STE006": "`{data.current.path}' must be a subtype of the corresponding type `{data.conflictsWith.path}'",
	"STE007": "`{data.current.path}' has no corresponding type in the ancestor restriction and therefore must be a subtype of `{data.conflictsWith.path}'",
	"STE008": "`{data.current.path}' must be a subtype the property definition `{data.conflictsWith.path}' as it has not been overridden",
	"STE009": "`{data.current.path}' must be a subtype of item `{data.conflictsWith[1].path}' as it has no corresponding item in `{data.conflictsWith[0].path}'",
	"STE010": "`{data.current.path}' must be a subtype of `{data.conflictsWith[0].path}' when `{data.conflictsWith[1].path}' is not present in the schema chain",
	"STE011": "`{data.current.path}' must be a subtype of `{data.conflictsWith[1].path}' when `{data.conflictsWith[2].path}' is greater than the size of `{data.conflictsWith[0].path}'",
	"STE012": "Base type `{data.current.value}' is not a subtype of base type `{data.conflictsWith.value}'",
	"STE013": "`{data.current.path}' is a subtype of `{data.conflictsWith.path}' and therefore has been disallowed",
	"STE014": "`{data.current.path}' must be a subtype of at least one of the types in `{data.conflictsWith.path}'",
	"STE015": "`{data.current.path}' must be a strict subtype of at least one of the types in `{data.conflictsWith.path}'",
	"IE000": "New property `{data.current.path}' introduced but not allowed due to `{data.conflictsWith.path}' having value `{data.conflictsWith.value}'",
	"IE001": "An element `{data.current.value}' not contained in `{data.conflictsWith.path}' has been introduced into the enumeration `{data.current.path}'",
	"IVE000": "`{data.current.path}` has invalid value.  Schema `{data.current.value}' is not registered in the known schemas",
	"IVE001": "`{data.current.path}` has invalid value.  Schema id `{data.current.value}' is the name of a previously defined schema",
	"IVE002": "The number of items in `{data.current.path}' must be greater than or equal to `{data.conflictsWith[0].path}' because `{data.conflictsWith[1].path}' has value `{data.conflictsWith[1].value}'",
	"IVE003": "The number of items in `{data.current.path}' must be less than or equal to `{data.conflictsWith.path}'",
	"IVE004": "`{data.current.path}' must be a tuple type because `{data.conflictsWith[0].path}' is a tuple and `{data.conflictsWith[1].path}' having value `{data.conflictsWith[1].value}' does not allow for an infinite number of values",
	"IVE005": "`{data.current.path}' contains more items than are allowed by `{data.conflictsWith[*].path}'",
	"IVE006": "`{data.current.path}' cannot have the value `{data.current.value}' because required property `{data.conflictsWith.path}' is no longer required",
	"IVE007": "`{data.current.path}' cannot have the value `{data.current.value}' because required property `{data.conflictsWith.path}' has not been overridden",
	"IVE008": "`{data.current.path}' cannot have the value `{data.current.value}' because the size of `{data.conflictsWith[0].path}' is equal to `{data.conflictsWith[1].path}'",
	"IVE009": "`{data.current.path}' cannot have the value `{data.current.value}' because the size of `{data.conflictsWith[0].path}' is equal to the size of `{data.conflictsWith[1].path}' and `{data.conflictsWith[2].path}' has value `{data.conflictsWith[2].value}'",
	"IVE010": "`{data.current.path}' ({data.current.value}) must be greater than or equal to `{data.conflictsWith.path}' ({data.conflictsWith.value})",
	"IVE011": "`{data.current.path}' ({data.current.value}) must be less than or equal to `{data.conflictsWith.path}' ({data.conflictsWith.value})",
	"IVE012": "Schema could not be un/registered because it has no id property",
	// removed as lack of type and extends restrictions constitutes implicit extension of type `any'
	//"IVE013": "An extension must contain at least a type (implicit extension) or extends (explict extension) restriction",
	"IVE014": "`{data.current.path}' ({data.current.value}) must be an integer",
	"TE000": "`{data.current.path}' has invalid type `{data.current.value}'.  The required type is `{data.requires.value}'"
};